package com.dt.platform.generator.module.oa;

import com.dt.platform.constants.db.OaTables;
import com.dt.platform.generator.config.Config;
import com.github.foxnic.generator.config.WriteMode;
import org.github.foxnic.web.domain.hrm.Employee;

public class NetDiskRecordGtr extends BaseCodeGenerator {


    public NetDiskRecordGtr() {
        super(OaTables.OA_NETDISK_OPER_RECORD.$TABLE,"755784921531809792");
    }

    public void generateCode() throws Exception {
        System.out.println(this.getClass().getName());
        cfg.view().field(OaTables.OA_NETDISK_OPER_RECORD.ID).basic().hidden(true);
        cfg.getPoClassFile().addSimpleProperty(Employee.class,"user","user","user");
        cfg.view().field(OaTables.OA_NETDISK_OPER_RECORD.OPER_USER_ID).table().fillBy("user","name");
        cfg.view().field(OaTables.OA_NETDISK_OPER_RECORD.OPER_USER_ID).form().button().chooseEmployee(true);
        cfg.view().field(OaTables.OA_NETDISK_OPER_RECORD.OPER_USER_ID).form().readOnly();

        cfg.view().list().disableBatchDelete();
        cfg.view().list().disableSingleDelete();
        cfg.view().list().disableCreateNew();

        cfg.view().search().labelWidth(1,Config.searchLabelWidth);
        cfg.view().search().labelWidth(2,Config.searchLabelWidth);
        cfg.view().search().labelWidth(3,Config.searchLabelWidth);
        cfg.view().search().labelWidth(4,Config.searchLabelWidth);
        cfg.view().search().inputWidth(Config.searchInputWidth);
        cfg.view().formWindow().bottomSpace(120);
        cfg.view().field(OaTables.OA_NETDISK_OPER_RECORD.OPER_TIME).search().range();

        cfg.view().search().inputLayout(
                new Object[]{
                        OaTables.OA_NETDISK_OPER_RECORD.OPER_USER_ID,
                        OaTables.OA_NETDISK_OPER_RECORD.OPER_TIME,
                }
        );


        //文件生成覆盖模式
        cfg.overrides()
                .setServiceIntfAnfImpl(WriteMode.COVER_EXISTS_FILE) //服务与接口
                .setControllerAndAgent(WriteMode.COVER_EXISTS_FILE) //Rest
                .setPageController(WriteMode.COVER_EXISTS_FILE) //页面控制器
                .setFormPage(WriteMode.COVER_EXISTS_FILE) //表单HTML页
                .setListPage(WriteMode.COVER_EXISTS_FILE)
                .setExtendJsFile(WriteMode.COVER_EXISTS_FILE); //列表HTML页
        //列表HTML页
        //生成代码
        cfg.buildAll();
    }

    public static void main(String[] args) throws Exception {
        NetDiskRecordGtr g=new NetDiskRecordGtr();
        //生成代码
        g.generateCode();
        //移除之前生成的菜单，视情况执行
//        g.removeByBatchId("471622036347682816");
        //生成菜单
     //   g.generateMenu(NetdiskOperRecordServiceProxy.class, NetdiskOperRecordPageController.class);
    }

}
